﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BKO.Domain.Services;
using BKO.Domain.Model;
using BKO.Domain.Repositories;

namespace BKO.Services
{
	public class SPRService<IEntity> : BaseService<IEntity>, ISPRService<IEntity> where IEntity : ISPREntity
	{
		public SPRService(IRepository<IEntity> repository)
			: base (repository) {}

		public IEntity Add(int mfgId, string name, string description, string a, string b, string c)
		{
			IEntity entity = Repository.CreateEmpty();
			entity.MfgId = mfgId;
			entity.Name = name;
			entity.Description = description;
			entity.A = a;
			entity.B = b;
			entity.C = c;
			Repository.Add(entity);
			return entity;
		}

		public void Update(int id, int mfgId, string name, string description, string a, string b, string c)
		{
			IEntity entity = Get(id);
			entity.Name = name;
			entity.Description = description;
			entity.MfgId = mfgId;
			entity.A = a;
			entity.B = b;
			entity.C = c;
			Repository.Update();
		}
	}
}
